<?php
/**
 * hotlinkcontroller.php
 * 
 * Create on 2015-04-01 17:18:43
 * Create by yuebin
 */
namespace haibao\cms\business\control\pc\index;

class HotlinkController extends \haibao\cms\business\control\pc\channel\ChannelController{
	
	public function __construct($updateTime = null,$controlId,$isPublish){
	    $this->savaLog();
		parent::__construct($updateTime,$controlId,$isPublish);
	}
	
	/**
	 * 显示模版内容（模版动态数据的绑定和模版输出）
	 * @param : String $content
	 * @param : Array $controlData;
	 */
	public function displayTemplateHtml(){

		$controlData = $this->getParameter(self::$CONTROL_DATA);
		$content = $this->getParameter(self::$CONTROL_CONTENT);
		$path = $this->generateHtmlPath(__CLASS__);
		$parameters = array();
		if($controlData['auto']){
			
			$temp = array();
			foreach($controlData['auto'] as $data){
				$parameterValue = json_decode($data['ParameterValue']);
				array_push($parameters,$parameterValue);
			}
		}
		if($controlData['manual']){
			if(isset($controlData['manual']['limit'])) $parameters = array_slice($parameters, 0,$controlData['manual']['limit']);
		};
			
		$this->assign('parameters', $parameters);
		$this->generateHtml($path,$content);
		return $this->getHtml($path);
	}
	
}